Function Get-TaskFolder(){
    [CmdletBinding()]param(
		[string]$vdi=$env:COMPUTERNAME,
		[string]$domain="nam",
		[string]$fid="aaadmin",
		[string]$pswd,
		[string]$folder = "\",
		[boolean]$refresh # force connect service even already exists
	)
	Try{
		$tsc=New-TaskConnection $vdi $domain $fid $pswd # tsc == task connection
		# tsf == task folder
		If( $refresh -or !(Get-Variable "TSF_$vdi`_$folder" -Scope Global -ea 4)){ 
			Set-Variable -Name "TSF_$vdi`_$folder" -Value ($tsc.GetFolder($folder)) -Scope Global -Force
		}
		return (Get-Variable "TSF_$vdi`_$folder").Value
	}Catch{
	    throw $_
	}Finally{}
}